package com.liuceng.zen;

import java.util.ArrayList;
import java.util.List;

import com.github.miemiedev.mybatis.paginator.domain.Order;
import com.liuceng.zen.pojo.form.BaseForm;

import lombok.Data;


@Data
public class Page<T> {
  // private static final int DEFAULT_MAX_PAGE_SIZE = 1000;
  private int totalCount;
  private List<T> content = new ArrayList<T>();;
  private BaseForm baseForm;

  public Page() {}

  public Page(List<T> content, int total) {
    this.totalCount = total;
    this.content.addAll(content);
  }

  public Page(List<T> content, int total, BaseForm baseForm) {
    this.totalCount = total;
    this.content.addAll(content);
    this.baseForm = baseForm;
  }

  /**
   * 获取页码
   * 
   * @return 页码
   */
  public int getPageNumber() {
    return baseForm.getPageNumber();
  }

  /**
   * 获取每页记录数
   * 
   * @return 每页记录数
   */
  public int getPageSize() {
    return baseForm.getPageSize();
  }

  /**
   * 获取最大页数
   */
  // public int getTotalCount() {
  //
  //
  // return this.totalCount > DEFAULT_MAX_PAGE_SIZE ? DEFAULT_MAX_PAGE_SIZE : this.totalCount;
  // }

  /**
   * 获取排序
   * 
   * @return 排序
   */
  public List<Order> getOrders() {
    return baseForm.getOrders();
  }
}
